package com.twu.biblioteca;


import java.io.PrintStream;
import java.util.Scanner;

public class ConsoleUserInterface implements UserInterface {

    private final Scanner scanner;
    private final PrintStream printStream;

    public ConsoleUserInterface(Scanner scanner, PrintStream printStream) {
        this.scanner = scanner;
        this.printStream = printStream;
    }

    @Override
    public void showMessage(String message) {
        this.printStream.println(message);
    }

    @Override
    public int getOptionInput() {
        return Integer.parseInt(scanner.nextLine()) - 1;
    }

    @Override
    public String getNameOfBookToUpdate() {
        return scanner.nextLine();
    }

    @Override
    public String getLibraryNumber() {
        this.showMessage("Please input your library number");
        return scanner.nextLine();
    }

    @Override
    public String getPassword() {
        this.showMessage("Please input your password");
        return scanner.nextLine();
    }
}
